#include <iostream>

using namespace std;

int main()
{
    int week, day;
    cin >> week >> day;
    int ans = 0;
    for (int i=1; i<=day; ++i)
    {
        if (week<=5) ++ans;
        if (week==7) week = 1;
        else ++week;

    }
    cout << ans * 250;
    return 0;
}
